<% include ../header.ejs %>

<link rel="stylesheet" href="/stylesheets/app/home/home.css">

<!--<link rel="stylesheet" href="/lib/vux/vux.min.css">-->

<script src="/lib/vue/vue.min.js"></script>
<!--<link rel="stylesheet" href="/lib/vux/components/search/index.min.css">-->
<!--<script src="/lib/vux/components/search/index.min.js"></script>-->
<!--<script src="/lib/vux/vux.min.js"></script>-->


<link rel="stylesheet" href="/lib/mint-ui/mint.css">

<!-- 引入组件库 -->
<script src="/lib/mint-ui/mint.js"></script>
<style>
    p{margin: 0 auto;}
    /*.weui-cells.vux-search_show{    max-height: 140px;}*/
</style>
<% if (userinfo){%>
<div id="demo">
<header data-am-widget="header" data-am-sticky class="am-header am-header-default" id="appTemplates-Nav">
    <h1 class="am-header-title">
        <a href="#title-link" class="" id="Typeface-whitecolor">首页</a>
    </h1>
</header>

    <mt-search v-model="value" >
        <mt-cell
                v-for="item in result"
                :title="item.title"
                :value="item.value"
                :to="item.to"
                is-link = 'true'
        >
        </mt-cell>


    </mt-search>
    <!--<search v-model="value" :autoFixed="autoFixed"  @on-change="getResult" :results="results"  @on-submit="onSubmit" top="49px" @result-click="resultClick"></search>-->


<div class=" am-slider-default" data-am-flexslider id="demo-slider-0">
       <img src="" id = "titleImg" class="am-img-responsive"/>
</div>



<ul class="mainmenu" id="Typeface-blackcolor">



        <li><a href="/smtool_project/wxapp/morningconference/index"><b><img src="/images/icon/moreservice.png" /></b><span id="Typeface-blackcolor">晨会</span></a></li>
        <li><a href="/smtool_project/wxapp/schedule/index"><b><img src="/images/icon/evaluate.png" /></b><span id="Typeface-blackcolor">工作日程</span></a></li>
        <li><a href="/smtool_project/wxapp/stockrecommend/stockrecommendindex"><b><img src="/images/icon/recommend.png" /></b><span id="Typeface-blackcolor">金股</span></a></li>
        <li><a href="/smtool_project/wxapp/stockpool/stockpoolindex"><b><img src="/images/icon/stockpool.png" /></b><span id="Typeface-blackcolor">股票池</span></a></li>
        <!--<li><a href=""><b><img src="/images/icon/report.png" /></b><span id="Typeface-blackcolor">研究报告</span></a></li>-->
        <li><a href="/smtool_project/wxapp/addressbook/index"><b><img src="/images/icon/contact.png" /></b><span id="Typeface-blackcolor">通讯录</span></a></li>
        <!--<li><a href="/smtool_project/wxapp/globalschedule/index"><b><img src="/images/icon/calendar.png" /></b><span id="Typeface-blackcolor">我的日程</span></a></li>-->
        <li><a href="/smtool_project/wxapp/statistics/statisticsCount"><b><img src="/images/icon/statistics.png" /></b><span id="Typeface-blackcolor">统计分析</span></a></li>

        <li><a href="/smtool_project/wxapp/stockGroup/index"><b><img src="/images/icon/report.png" /></b><span id="Typeface-blackcolor">行业组合</span></a></li>
        <li><a href="/smtool_project/wxapp/knowledge/index"><b><img src="/images/icon/knowledge.png" /></b><span id="Typeface-blackcolor">知识中心</span></a></li>








    <!--<%if (session.channelportal== 'wx') {%>-->
            <!--&lt;!&ndash;&lt;!&ndash;如果微信渠道进入，则不显示修改密码&ndash;&gt;&ndash;&gt;-->
        <!--<%}else{%>-->
            <!--<li><a href="/smtool_project/wxapp/myinfo/getmyuserinfo"><b><img src="/images/icon/editpassword.png" /></b><span id="Typeface-blackcolor">修改密码</span></a></li>-->
        <!--<%}%>-->

</ul>
</div>
<%}%>

<script src="/javascripts/app/home/home.js"></script>

<script>

    new Vue({
        el: '#demo',
        data:function() {
            return{
                value:"",
                how: 'Cool',
                result:[],
                test:[],
            }
        },
        watch:{
          value:function (){
              console.log('on-change', this.value)
              this.result = this.value ? pingResult(this.value) : [];
              this.test = this.value ? pingResult(this.value) : []
          }
        },
        mounted:function () {

        },
        methods: {
            getResult :function(val) {
                console.log('on-change', val)
                this.result = val ? pingResult(this.value) : []
            },
            resultClick:function (item) {
                location.href = "../wxapp/search/searchList?key="+item.key+"&type="+item.type;
                //window.alert('you click the result item: ' + JSON.stringify(item))
            },
            onSubmit:function(val){
                location.href = "../wxapp/search/searchList?key="+val+"&type=keyLike";
            }
        }
    })
    function pingResult (val) {
        let rs = [];
        $.post("../wxapp/search/keysearch",{key:val},function(res){
            console.log(res.searchList);
            for (let i = 0; i < res.searchList.length; i++) {
                rs.push({
                    title: res.searchList[i].val ,

//                    key: res.searchList[i].rowId,
//                    type: res.searchList[i].type,
                    to:"../wxapp/search/searchList?key="+res.searchList[i].rowId+"&type="+res.searchList[i].type
                    //other: i
                })
            }
        })

        return rs
    }


    $(function () {

        var date = new Date();
        var time = date.getHours();
        if(time >=6 && time <9)
            $("#titleImg").attr("src", "/images/banner/morning6-9.jpg");
        if(time >=9 && time <12)
            $("#titleImg").attr("src","/images/banner/morning9-12.jpg");
        if(time >=12 && time <13)
            $("#titleImg").attr("src", "/images/banner/noon12-1.jpeg");
        if(time >=13 && time <15)
            $("#titleImg").attr("src","/images/banner/afternoon13-15.jpg");
        if(time >=15 && time <17)
            $("#titleImg").attr("src", "/images/banner/afternoon15-17.jpeg");
        if(time >=17 && time <22)
            $("#titleImg").attr("src", "/images/banner/night17-22.jpeg");
        if(time >=22 || time <6)
            $("#titleImg").attr("src","/images/banner/night22-6.jpg");

        $('.am-slider').flexslider({
            // options
            touch:false
        });
    })

</script>
<% include ../footer.ejs %>
